﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace EntityModule
{
    public class NewsDetailService
    {
        public SportDataContext Service { get { return EntityService.Instance(); } }

        public void Insert(NewsDetail news)
        {
            news.ID = Guid.NewGuid();
            Service.NewsDetails.InsertOnSubmit(news);
            Service.SubmitChanges();
        }
        public List<NewsDetail> GetNews(int page, int pageSize)
        {
            List<NewsDetail> news = Service.NewsDetails.Where(s => s.IsDel == null).Skip(page * pageSize).Take(pageSize).ToList();
            return news;
        }

        public List<NewsDetail> GetNews(Guid guid)
        {
           return  Service.NewsDetails.Where(s => s.ID == guid).ToList();
        }
    }
}
